package testcases.OpportunitiesBaseDataView.MainViewAfterFilterSelection.STG;
import resources.testcases.OpportunitiesBaseDataView.MainViewAfterFilterSelection.STG.F09_Opportunities_Base_Data_View_Simple_Filter_Opportunity_FilterHelper;
import tasks.Loading;
import tasks.OpportunitiesBaseData.Filters.Applier;
import tasks.OpportunitiesBaseData.MainView.Filters;
import tasks.OpportunitiesBaseData.MainView.STGVerifierAfterAppliedFilters;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.ControlsMapping;
import core.Preconditions;
import core.enums.Reports;
/**
 * Description   : Functional Test Script
 * @author nataliya.dimitrova
 */
public class F09_Opportunities_Base_Data_View_Simple_Filter_Opportunity_Filter extends F09_Opportunities_Base_Data_View_Simple_Filter_Opportunity_FilterHelper
{
	/**
	 * Script Name   : <b>F09_Opportunities_Base_Data_View_Simple_Filter_Opportunity</b>
	 * Generated     : <b>15.12.2011 15:20:04</b>
	 * Description   : Functional Test Script
	 * Original Host : WinNT Version 6.1  Build 7601 (S)
	 * 
	 * @since  2011/12/15
	 * @author nataliya.dimitrova
	 */
	private boolean stepResult = false;
	private Applier filterApplier = new Applier();
	private STGVerifierAfterAppliedFilters verifier = new STGVerifierAfterAppliedFilters();
	private Filters filter = new Filters();
	
	private String territory = "Opportunities inside territory";  //Opportunities inside territory/Opportunities outside territory
	private String insideSalesInvolved = "Yes"; //Yes/No
	private String salesStageGroup = "Identified Pipeline (1-3)"; //Open Validated (4-6)/Won Pipeline (7-8)..
	private String owningOrg = "Business Partners";  //Telesales/Telecoverage 
	private String opptyRole = "IDNT - Identifier"; //NTCR - Noticer/OWNR - Owner
	private String opptySource = "Business Partner";	//Campaign/TeleWeb
	private String pipelineAgeRevenue = "<30 days"; //30-60 days/90 - 180 days/> 270 days
	private String stuckPipeline = "Yes"; //Yes/No
	private String duplicateOppty = "No";  //Yes/No
 
	
	private boolean testCasePreconditions() {
		boolean preconditionResult = false;
		preconditionResult = Preconditions.globalPreconditionCognos(Reports.OpportunitiesBaseDataView);
		return preconditionResult;
	}

    public void executeTest()
    {
        beginTestCase("F09",
                      "Verify that the fields in the Front End - Opportunities Base Data View - Main View - STG Brand, after applied Opportunity Filter with all filters selection, are populated with the respective data from Data Base after applied filters",
                      "",
                      "Nataliya Dimitrova",
                      "",
                      "");
        
        if (testCasePreconditions())
        {     
        	TimeWait(3);
        	
        	//applied desired combination of filter selections
        	stepResult = ControlsMapping.FilterCommonElements.showAll_link.clickLink();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.showAll_link.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	filterApplier.applyOpportunityFilter(territory, insideSalesInvolved, salesStageGroup, owningOrg, opptyRole, opptySource, pipelineAgeRevenue, stuckPipeline, duplicateOppty, false);
        	 
        	filter.setTerritory(territory);
        	filter.setIns_sal_inv(insideSalesInvolved);
        	filter.setSle_stage_group(salesStageGroup);
        	filter.setOwning_org(owningOrg);
        	filter.setOppty_role(opptyRole);
        	filter.setChanl_name(opptySource);
        	filter.setAge_range_name(pipelineAgeRevenue);
        	filter.setStuck_pipeline_indc(stuckPipeline);
        	filter.setDup_opp_indc(duplicateOppty);
        
        	
        	stepResult = ControlsMapping.FilterCommonElements.GO_button.clickButton();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.GO_button.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	stepResult = verifier.verify(filter);
        	setStepResult(stepResult, "Verify front end and DB content.");
        }
    }
    
    public void testMain(Object[] args)
    {
    	setUp(args);
        executeTest();
        reportTestCaseResult("F09 - Opportunities Base Data View - Simple Filter", Configurations.PROJECT_NAME);
    }
}

